feat: Add UpdateToken #2474
Conversation
Signed-off-by: aceppaluni <aceppaluni@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds the ChangesToken Update RPC
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant update_token
participant TokenUpdateTransaction
participant HederaNetwork
Client->>update_token: UpdateTokenParams
update_token->>TokenUpdateTransaction: Build update fields
update_token->>TokenUpdateTransaction: Execute transaction
TokenUpdateTransaction->>HederaNetwork: Submit token update
HederaNetwork-->>update_token: Receipt status
update_token-->>Client: UpdateTokenResponse
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 71fedbdb-d60d-489d-b015-8e667cf0ac3e
📒 Files selected for processing (3)
tck/handlers/token.pytck/param/token.pytck/response/token.py
Signed-off-by: aceppaluni <aceppaluni@gmail.com>
manishdait
left a comment
There was a problem hiding this comment.
@aceppaluni, small change request, rest looks good
| transaction = TokenUpdateTransaction().set_grpc_deadline(DEFAULT_GRPC_TIMEOUT) | ||
|
|
||
| if params.tokenId is not None: | ||
| transaction.set_token_id(TokenId.from_string(params.tokenId)) |
There was a problem hiding this comment.
we need to remove the fail fast check for token id in the TokenUpdateTransaction _build_proto_body()
| if params.adminKey is not None: | ||
| transaction.set_admin_key(get_key_from_string(params.adminKey)) | ||
|
|
||
| if params.kycKey is not None: |
There was a problem hiding this comment.
also some tck tests pass a keyList with an empty list of keys, which is valid. however, current generate_key currently has this check:
if params.type in {KeyType.THRESHOLD_KEY, KeyType.LIST_KEY} and not params.keys:
raise JsonRpcError.invalid_params_error(
"invalid parameters: keys must be provided for keyList or thresholdKey types."
)
hiero-sdk-python/tck/handlers/key.py
Line 45 in f96a87d
since not params.keys is also True for an empty list, it raises an error for a valid input.
There was a problem hiding this comment.
it should check for the pramas.keys is None
Description:
Implements the
updateTokenJSON-RPC endpoint in the TCK module by adding the required parameter, response, and handler layers following the existing token transaction conventions.The new endpoint integrates through the existing
@rpc_methodregistration flow and does not require any server, protocol, or handler registration changes.Changes
Parameter layer
Added
UpdateTokenParamsintck/param/token.py.Added support for all
TokenUpdateTransactionfields exposed by the TCK surface:tokenIdname,symbol,memo,metadata)treasuryAccountId,autoRenewAccountId)adminKey,kycKey,freezeKey,wipeKey,supplyKey,feeScheduleKey,pauseKey,metadataKey)expirationTime,autoRenewPeriod)Kept key, expiration, and auto-renew values as raw strings in params, matching existing
createTokenconventions and deferring conversion to the handler layer.Intentionally omitted
keyVerificationModeto align with the resolved TCK parameter surface.Response layer
UpdateTokenResponseas aStatusOnlyResponse.DeleteTokenResponse,FreezeTokenResponse, andPauseTokenResponse.Handler layer
Added
TokenUpdateTransactionsupport.Added
_build_update_token_transaction()to construct update transactions with:Added the
updateTokenRPC handler:ResponseCodeRelated issue(s):
Fixes #2397
Notes for reviewer:
Checklist